if(F){
    
    library("pacman")
    p_load("dplyr")
    p_load("plyr")
    p_load("ggplot2")
    p_load("stringr")
    p_load("reshape2")
    p_load("PMCMR")
    p_load("ggforce")
    p_load(openxlsx)
    p_load(Loafer)

    get_or_set_dir()
    
    "Demo to start with"    
    ## application of the function.
    data(iris)

    # colnames(iris)
    if(F){
        input_df = iris[,1:4]
        input_df = iris[,1, drop = F]
        input_df$Sepal.Length <- rnorm(nrow(input_df))
        group_info_df = iris[,5,drop = F]
        group_index = 1
        group_levels_in_order_C = group_info_df[,1] %>% unique()
        test_pattern  = "non-para" %>% tolower()
        test_pattern  = "wise" 
        test_pattern  = "para" 
        p_for_label <- "p_all"
        step = 0.15
        position_by = "max single value"
        draw_pics = F
        unify_step_as_constant = F

        get_step_by_max_instead_of_range = T

        
    }
    
    # obj <- get_pic_with_labels(input_df = iris[,1:3],
    obj <- get_pic_with_labels(input_df = iris[,1:4,drop = F],
                               # input_df$Sepal.Length <- rnorm(nrow(input_df)),
                               group_info_df = iris[,5,drop = F],
                               group_index = 1,
                               group_levels_in_order_C = iris[,5] %>% unique(),
                               test_pattern  = "para" ,
                               # test_pattern  = "non-para" ,
                               # test_pattern  = "wise" ,
                               # test_pattern  = "non-para" %>% tolower(),
                               p_for_label = "p_all",
                               step = 0.05, # Modify the vertical distances between significant label codes.
                               draw_pics = F, 
                               # position_by = "max single value")
                               position_by = "maxmeanse")
    
    obj@result_df # P-value result.
    obj@label_position_df # df for labeling in the plot.
    cat(obj@demo_code) ## Chek codes for visualization.
    
    variables_c <- obj@pic_long_df$variable %>% unique
    page_num <- variables_c %>% length
    segment_size <- .7 ## The size of the segement
    # each_page <- 1
    obj@pic_long_df
    for(each_page in 1:page_num){
        
        each_meta <- variables_c[each_page]
        
        pic <- ggplot(obj@pic_long_df) + 
            # geom_errorbar(aes(x = group,  ymax = mean + se, ymin = mean - se, ## 将最小值藏起来。 
            #                   color = group, group = group),
            #               width = 0.45, size = 0.6, color = 'black')+
            ## the key to do this is move aes attr into the following geom_XXXX line. Insdead of the first line.
            # geom_bar(stat  = 'identity', aes(x = group, y = mean(value), fill = group, group = group))+
            # geom_bar(aes(x = group, y = mean, fill = group, group = group), 
            #          stat = 'identity', position = 'identity')+
            # geom_bar(aes(x = group, y = mean/count, fill = group, group = group), stat = 'identity', position = 'fill')+
            geom_boxplot(aes(x = group, y = value), data = obj@pic_long_df, outlier.colour = 'white',
                         # width = 2,
                         size  = .8)+
            theme_bw()+
            # geom_bar(aes(x = group, y = mean, fill = group, group = group), 
            #          stat = 'identity', position = 'identity')+
            geom_point(aes(x = group, y = value), shape = 21, color = 'black', fill = 'red', 
                       position = position_jitter(width = .15, height = 0), size = 1.3, alpha = .8)+ 
            # facet_wrap(facets = vars(variable), ncol = 3, scales = 'free')+
            facet_wrap_paginate(facets = vars(variable), scales='free', ncol = 1, nrow = 1, page = each_page)+
            # scale_fill_manual(values = color_vector_c)+
            theme(
                text = element_text(size = 18, color = 'black'),
                # legend.title = element_text(size = 22, color = 'black'),
                # legend.text = element_text(size = 18, color = 'black'),
                axis.text.y = element_text( size = 12, face = 'bold', color = 'black'),
                axis.text.x = element_text( size = 12, face = 'bold', color = 'black'),
                strip.text.x = element_text(size = 16, color = 'black'),
                # axis.text.x = element_blank(),
                ### 加横坐标，去除网格线。
                panel.grid = element_blank()
            )
        
        pic <- pic +
            geom_segment(data = obj@label_position_df,
                         aes(x = start_num, xend = start_num + 0.25 * (end_num - start_num),
                             y = label.y, yend = label.y), lineend = 'butt', size = segment_size)+
            geom_segment(data = obj@label_position_df, 
                         aes(x = end_num, xend = start_num + 0.75 * (end_num - start_num),
                             y = label.y, yend = label.y), 
                         lineend = 'butt', size = segment_size)+
            # geom_shadowtext(data = final_label_df, 
            #                 aes(x = 0.5*(start_num + end_num),
            #                     y = label.y, label = label), 
            #                 size = 5.5, bg.colour='firebrick') + 
            geom_text(data = obj@label_position_df, 
                      aes(x = 0.5*(start_num + end_num), y = label.y*1.007, label = label)
                      ,color = 'black', size = 8) +
            geom_segment(data = obj@label_position_df, aes(x = start_num, xend = start_num, y = label.y, yend = label.y * .99), lineend = 'round', size = segment_size)+
            geom_segment(data = obj@label_position_df, aes(x = end_num, xend = end_num, y = label.y, yend = label.y * .99), lineend = 'round', size = segment_size)+
            # geom_segment(data = final_label_df, aes(x = end_num, xend = end_num, y = label.y, yend = label.y * .99), lineend = 'round', size = segment_size) + 
            geom_segment(data = obj@label_position_df, aes(x = start_num, xend = end_num, y = label.y, yend = label.y),
                         size = segment_size) + 
            xlab('Group')+
            ylab('Concentration (μmol/L)')+
            scale_y_continuous(expand = expansion(c(0.05,0.05)))
        ### geom_text can be reguarded as num value when the x shows factor variable.
        
        plot_name <- sprintf('%splot with sig labels #%s.pdf', output_path, each_meta)
        
        ggsave(plot_name, plot = pic, width = 5, height = 4, 
               limitsize = F, family = 'serif')
        
    }
    
}

